import { createRouter, createWebHistory } from "vue-router";

const routes = [
  {
    path: "/",
    name: "layout",
    component: () => import("../views/layout/Layout.vue"),
    redirect: "/home", // 默认重定向到首页
    children: [
      {
        path: "home",
        name: "home",
        component: () => import("../views/home/index.vue"),
      },
      {
        path: "clue/list",
        name: "clue-list",
        component: () => import("../views/clue/list.vue"),
      },
      {
        path: "clue/pool",
        name: "clue-pool",
        component: () => import("../views/clue/pool.vue"),
      },
      {
        path: "business/list",
        name: "business-list",
        component: () => import("../views/business/list.vue"),
      },
      {
        path: "business/pool",
        name: "business-pool",
        component: () => import("../views/business/pool.vue"),
      },
      {
        path: "customer",
        name: "customer",
        component: () => import("../views/customer/index.vue"),
      },
      {
        path: "resource/course",
        name: "resource-course",
        component: () => import("../views/resource/course.vue"),
      },
      {
        path: "resource/activity",
        name: "resource-activity",
        component: () => import("../views/resource/activity.vue"),
      },
      {
        path: "system/dept",
        name: "system-dept",
        component: () => import("../views/system/dept.vue"),
      },
      {
        path: "system/role",
        name: "system-role",
        component: () => import("../views/system/role.vue"),
      },
      {
        path: "system/user",
        name: "system-user",
        component: () => import("../views/system/user.vue"),
      },
      {
        path: "system/log",
        name: "system-log",
        component: () => import("../views/system/log.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
});

export default router;

// import { createRouter, createWebHistory } from "vue-router";

// const router = createRouter({
//   history: createWebHistory(import.meta.env.BASE_URL),
//   routes: [
//     {
//       path: "/",
//       redirect: "/home",
//     },
//     {
//       path: "/layout",
//       name: "layout",
//       component: () => import("../views/layout/Layout.vue"),
//       redirect: "/home",
//       children: [
//         {
//           path: "/home",
//           name: "home",
//           component: () => import("../views/home/index.vue"),
//           meta: { title: "首页" },
//         },
//         {
//           path: "/clue/list",
//           name: "clueList",
//           component: () => import("../views/clue/list.vue"),
//           meta: { title: "线索列表" },
//         },
//         {
//           path: "/clue/pool",
//           name: "cluePool",
//           component: () => import("../views/clue/pool.vue"),
//           meta: { title: "线索池" },
//         },
//         {
//           path: "/business/list",
//           name: "businessList",
//           component: () => import("../views/business/list.vue"),
//           meta: { title: "商机列表" },
//         },
//         {
//           path: "/business/pool",
//           name: "businessPool",
//           component: () => import("../views/business/pool.vue"),
//           meta: { title: "公海池" },
//         },
//         {
//           path: "/customer",
//           name: "customer",
//           component: () => import("../views/customer/index.vue"),
//           meta: { title: "客户管理" },
//         },
//         {
//           path: "/resource/course",
//           name: "course",
//           component: () => import("../views/resource/course.vue"),
//           meta: { title: "课程管理" },
//         },
//         {
//           path: "/resource/activity",
//           name: "activity",
//           component: () => import("../views/resource/activity.vue"),
//           meta: { title: "活动管理" },
//         },
//         {
//           path: "/system/dept",
//           name: "dept",
//           component: () => import("../views/system/dept.vue"),
//           meta: { title: "部门管理" },
//         },
//         {
//           path: "/system/role",
//           name: "role",
//           component: () => import("../views/system/role.vue"),
//           meta: { title: "角色管理" },
//         },
//         {
//           path: "/system/user",
//           name: "user",
//           component: () => import("../views/system/user.vue"),
//           meta: { title: "用户管理" },
//         },
//         {
//           path: "/system/log",
//           name: "log",
//           component: () => import("../views/system/log.vue"),
//           meta: { title: "系统日志" },
//         },
//       ],
//     },
//   ],
// });

// export default router;
